package com.adrian.misc.fractal;

import java.applet.Applet;
import java.awt.Container;

import javax.swing.ImageIcon;

public class GUIService {
	private int guiType = FractalGUI.GUI_APPLET;
	private Container cnt;
	
	public GUIService(int GUIType, Container cont) {
		guiType = GUIType;
		cnt = cont; 

	}
	
	public ImageIcon getIcon(String file) {
		System.out.println("GUI TYPE =="+guiType);
		switch (guiType){
				case FractalGUI.GUI_APPLET:
					//return new ImageIcon(((Applet)cnt).getImage(((Applet)cnt).getCodeBase(),file));
					return new ImageIcon(getClass().getResource(file));
				case FractalGUI.GUI_STAND_ALONE:
					System.out.println("file=" + file+ ", IMAGE==" +getClass().getResource(file));
					return new ImageIcon(getClass().getResource(file));
				default:
					return null;
		}
	}
}
